﻿#pragma once

#include <QWidget>
#include <QTimer>
#include <Windows.h>
#include "DrawColumn.h"
namespace Ui { class HardWareMonitor; };

class HardWareMonitor : public QWidget
{
    Q_OBJECT

public:
    HardWareMonitor(QWidget *parent = Q_NULLPTR);
    ~HardWareMonitor();
protected:
    void closeEvent(QCloseEvent *event);
    void showEvent(QShowEvent *event);
    void hideEvent(QHideEvent *event);
private slots:
    void on_pushButton_clicked();
    void slotHandleTimeout();
private:
    double getCPUUseage();
    __int64 CompareFileTime(FILETIME time1, FILETIME time2);
private:
    Ui::HardWareMonitor *ui;
private:
    QTimer * m_pTimer;
private:
private:
    FILETIME _old_idle_time;
    FILETIME _old_kernel_time;
    FILETIME _old_user_time;
    FILETIME _idle_time;
    FILETIME _kernel_time;
    FILETIME _user_time;
};
